

function co(fn) {
    const gen = fn()

    function _next(data) {
        const { value, done } = gen.next();
        if (done) return value
        if (value.then) {
            value.then(res => _next(res))
        } else {
            _next(value)
        }

    }

    _next()
}